/*
 * @Author: scl
 * @Date: 2023-09-17 23:53:13
 * @LastEditTime: 2023-09-18 15:26:58
 * @Description: file content
 */
import { http } from "@/utils/http"
import type { AddressParams, AddressItem } from '@/types/address'
/**
 * 添加收货地址
 * @param data 请求参数
 */
export const postMemberAddressAPI = (data: AddressParams) => {
    return http({
        url: "/member/address",
        method: "POST",
        data
    })
}
/**
 * 获取收货地址列表
 */
export const getMemberAddressAPI = () => {
    return http<AddressItem[]>({
        url: "/member/address",
        method: "GET"
    })
}
/**
 * 获取收货地址详情
 * @param id 地址id(路径参数)
 */
export const getMemberAddressByIdAPI = (id: string) => {
    return http<AddressItem>({
        url: `/member/address/${id}`,
        method: "GET"
    })
}
/**
 * 修改收货地址
 * @param id 地址id(路径参数)
 * @param data 表单数据(请求体参数)
 */
export const putMemberAddressByIdAPI = (id: string, data: AddressParams) => {
    return http({
        method: 'PUT',
        url: `/member/address/${id}`,
        data,
    })
}
/**
 * 删除收货地址
 * @param id 地址id(路径参数)
 */
export const deleteMemberAddressByIdAPI = (id: string) => {
    return http({
        method: 'DELETE',
        url: `/member/address/${id}`,
    })
}